import java.util.*;

// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {
        int[] arr = {2,2,1,1,3};
        int s = singleNumber(arr);
        System.out.println(s);
    }
    public static int singleNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for(int i = 0; i< nums.length; i++) {
            set.add(nums[i]);
            if(set.contains(nums[i])) {
                set.remove(nums[i]);
            }

        }
        for(int i = 0; i< nums.length; i++) {
            if(set.contains(nums[i])) {
                return nums[i];
            }
        }
        return 1;
    }
    public static void main333(String[] args) {
        Map<String,Integer> map  = new HashMap<>();
        map.put("string",6);
        map.put("hellw",2);
        map.put("nums",1);
        //System.out.println(map);
       /* System.out.println(map.get("str"));
        System.out.println(map.getOrDefault("str",10));*/
        map.put("hello",111);
        map.put("hello",999);

      /*  for (Map.Entry<String,Integer> entry:map.entrySet()) {
            System.out.println("String: "+entry.getKey() +" "+ "Value: " + entry.getValue());
        }*/
       // System.out.println(map);
       /* for (String s :map.keySet()) {
            System.out.print(s+ " ");
        }*/

        Set<String> set  = new HashSet<>();
        set.add("a");
        set.add("b");
        set.add("c");
        set.add("d");
        set.add("a");
        System.out.println(set);

       // System.out.println(set.contains("a"));

        //  Set<Map.Entry<String,Integer>> set  = map.entrySet();

       /* set.
        for(Map.Entry<String,Integer> x:set) {
            System.out.println(x);
        }*/

      /*  String str = "abcdr";
        System.out.println(str.toUpperCase().toCharArray());*/


    /*   List<List<Integer>> list = new ArrayList<>();
        list.add(new ArrayList<Integer>(Arrays.asList(1,2,3)));
        list.add(new ArrayList<Integer>(Arrays.asList(4,5,6)));
        for(List<Integer> x:list) {
            System.out.println(x);
        }*/



    }
    public static void main22(String[] args) {
        // Press Alt+Enter with your caret at the highlighted text to see how
        // IntelliJ IDEA suggests fixing it.
        System.out.printf("Hello and welcome!");

        // Press Shift+F10 or click the green arrow button in the gutter to run the code.
        for (int i = 1; i <= 5; i++) {

            // Press Shift+F9 to start debugging your code. We have set one breakpoint
            // for you, but you can always add more by pressing Ctrl+F8.
            System.out.println("i = " + i);
        }
    }
}